import 'dart:async';
import 'dart:convert';

import 'package:flutter/services.dart';

class FlutterAliyunIdentity {
  static const MethodChannel _channel = MethodChannel('flutter_aliyun_identity');

  static Future<String?> get platformVersion async {
    final String? version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  static Future<String?> getMetaInfos() async {
    dynamic metaInfos = await _channel.invokeMethod('getMetaInfos');
    return metaInfos is String ? metaInfos : jsonEncode(metaInfos);
  }

  static Future<String?> verify(String certifyId) async {
    Map<String, String> params = {"certifyId": certifyId};
    dynamic result = await _channel.invokeMethod('verify', params);
    return result is String ? result : jsonEncode(result);
  }
}
